package com.ssm.ssmcontroller;


import com.ssm.po.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


import java.util.ArrayList;
import java.util.List;


/**
 * Created by Mars-Hasee on 2017/8/5.
 */
@Controller
public class UserController3 {

    @RequestMapping("/test.action")
    public ModelAndView handleRequest() throws Exception {
        List<User> userList = new ArrayList<>();
        ModelAndView modelAndView = new ModelAndView();
        //相当于reuest 中的setAttrabute方法
        modelAndView.addObject("userList",userList);
        //指定视图
        modelAndView.setViewName("index");
        return modelAndView;
    }


}
